package com.example.mapper.tribune;

import com.example.model.entity.tribune.Collect;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 操作collect相关数据接口
*/
public interface CollectMapper {

    /**
      * 新增
    */
    int insert(Collect collect);

    /**
      * 删除
    */
    int deleteById(Integer id);

    /**
      * 修改
    */
    int updateById(Collect collect);

    /**
      * 根据ID查询
    */
    Collect selectById(Integer id);

    /**
      * 查询所有
    */
    List<Collect> selectAll(Collect collect);

    @Select("select * from collect where userId = #{userId} and fid = #{fid} and module=#{module}")
    Collect selectByUserIdAndFid(Integer userId, Integer fid,String module);
    @Select("select * from collect where doctorId = #{doctorId} and fid = #{fid} and module=#{module}")
    Collect selectByDoctorIdAndFid(Integer doctorId, Integer fid,String module);
    @Select("SELECT * FROM collect WHERE userId IS NOT NULL")
    List<Collect> selectAllOKCollect(Object o);
}
